package com.mk.admin.service.impl;

import com.mk.admin.mapper.NoticeLikeMapper;
import com.mk.admin.model.ResultDto;
import com.mk.admin.model.entity.NoticeLikeEntity;
import com.mk.admin.model.query.NoticeLikeQuery;
import com.mk.admin.model.vo.NoticeLikeVo;
import com.mk.admin.service.NoticeLikeService;
import com.mk.admin.util.JSONCopy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class NoticeLikeServiceImpl implements NoticeLikeService {

    @Autowired
    private NoticeLikeMapper noticeLikeMapper;

    @Override
    public ResultDto select(NoticeLikeQuery query) {
        return ResultDto.data(noticeLikeMapper.select(JSONCopy.copy(query, NoticeLikeEntity.class)));
    }

    @Override
    public ResultDto add(NoticeLikeVo vo) {
        return ResultDto.data(noticeLikeMapper.insert(JSONCopy.copy(vo, NoticeLikeEntity.class)));
    }

    @Override
    public ResultDto update(NoticeLikeVo vo) {
        return ResultDto.data(noticeLikeMapper.updateById(JSONCopy.copy(vo, NoticeLikeEntity.class)));
    }

    @Override
    public ResultDto delete(int id) {
        return ResultDto.data(noticeLikeMapper.deleteById(id));
    }


    @Override
    public ResultDto status(int id) {
        return ResultDto.data(noticeLikeMapper.status(id));
    }
}
